package com.qfedu.mtl.service.impl;


import com.qfedu.mtl.dao.OdersDao;
import com.qfedu.mtl.dao.impl.OrderDaoImpl;
import com.qfedu.mtl.entity.Orders;
import com.qfedu.mtl.query.OrderQuery;
import com.qfedu.mtl.service.OrderService;
import com.qfedu.mtl.util.page.Pager;

import java.util.List;

/**
 * @version v1.0
 * @Date 2023/9/26 21:33
 * @Author 浪里小白条
 * @Email corday@qq.com
 */


public class OrderServiceImpl implements OrderService {
    OdersDao dao=new OrderDaoImpl();
    @Override
    public Pager<Orders> findPage(Integer page, Integer size, OrderQuery orderQuery) {
        //查询数据
        List<Orders> rows  =  dao.selectPageData( page,size , orderQuery );

        //查询条数
        Integer total =  dao.selectCount(  orderQuery );
        //构造分页实例
        Pager<Orders> pager = new Pager<>(rows, page, size, total);
        //返回
        return pager;
    }

    @Override
    public Integer deleteById(Integer id) {

        return dao.deleteById(id);
    }



    @Override
    public Integer update(Orders orders) {

        return dao.update(orders);
    }
}
